﻿using System;
using System.IO;

namespace ExcelConfig.Config
{
    public delegate void Password_Encrypt(ref string password);
    public static class ExcelConfigSetting
    {
        public static string YES = "是的";
        public static string NO = "不是";
        public static char ArraySplitChar = ';';

        public static string CONFIG_DEFAULT = "app";
        public static string CONFIG_SUFFIX = ".config.xlsx";
        public static string CONFIG_SUFFIX_INI = ".ini";

        public static string SHEET_Global = "全局";
        public static string COLUMN_KEY = "名称";
        public static string COLUMN_VALUE = "值";
        public static string CONFIG_PATH;
        public static Password_Encrypt PasswordEncrypt = ExcelConfigHelper.non_password_encrypt;

        static ExcelConfigSetting()
        {
            CONFIG_PATH = calc_default_configpath();
        }

        internal static string calc_default_configpath()
        {
            var ass = typeof(ExcelConfigSetting).Assembly;
            var asspath = ass.Location;

            //推断配置所在目录
            if (!string.IsNullOrEmpty(asspath)) return Path.GetDirectoryName(asspath);

            return Path.GetFullPath(".");
        }
    }
}
